home *** CD-ROM | disk | FTP | other *** search
/ Mission 3 / Mission 3.zip / Mission 3.iso / internet / cabdemo / docs / prog / module.h < prev   
C/C++ Source or Header  |  1998-08-29  |  5KB  |  177 lines

  1. /*
  2. ** module.h for Inet-Module
  3. ** API header for HTML.APP browser inet-module
  4. **
  5. ** Copyright (C) 1995, Stephane Boisson. All Rights reserved.
  6. ** Login <boisson@worldnet.net>
  7. **
  8. ** Started on  Sun Aug 27 22:21:42 1995 Stephane Boisson
  9. ** Last update Sun Oct 29 16:20:52 1995 Stephane Boisson
  10. **
  11. ** This file can be redistributed under the terms of the GNU General
  12. ** Public Licence.
  13. */
  14.  
  15. #ifndef __BROWSER_INET_API__H__
  16. #define __BROWSER_INET_API__H__
  17.  
  18. /*--- Macro for prototyping ---*/
  19. #ifdef __PUREC__
  20. #  define ___CDECL cdecl
  21. #else
  22. #  define ___CDECL
  23. #endif
  24.  
  25.  
  26. /*--- Magic values ---*/
  27. #define BROWSER_MAGIC1 0x48744d6cL
  28. #define BROWSER_MAGIC2 0x2f577757L
  29. #define BROWSER_MAGIC3 0x2d42724fL
  30. #define BROWSER_MAGIC4 0x77536552L  /* -> CAB must Mshrink     */
  31. #define BROWSER_MAGIC4BIS 0x77536572L  /* -> CAB must not Mshrink */
  32.  
  33. /*--- Init codes ---*/
  34. #define SUPPORT_PEXEC 1    /* module uses pexec() to call another prog */
  35. #define SUPPORT_HTTP 2
  36. #define SUPPORT_FTP 4
  37. #define SUPPORT_GOPHER 8
  38. #define SUPPORT_WAIS 16
  39. #define SUPPORT_MAILTO 32
  40. #define SUPPORT_NNTP 64
  41. #define SUPPORT_TELNET 128
  42.  
  43. /*--- Messages types for `msg_status' ---*/
  44. #define STATUS_CONNECTING_HOST 1
  45. #define STATUS_RECEIVING_DATA 2     /* val = bytes received */
  46. #define STATUS_WAITING_RESPONSE 3
  47. #define STATUS_RESOLVING_HOST 4
  48. #define STATUS_SENDING_REQUEST 5
  49. #define STATUS_FORMATTING_TEXT 6
  50. #define STATUS_LOADING_IMAGE 7
  51. #define STATUS_WAITINGFORDATA 10   /* val = timeout */
  52. #define STATUS_DATALENGTH 12345    /* val = length of data */
  53.  
  54. /*--- Alert boxes for `alert_box' ---*/
  55. #define ALERT_ABORT 0      /* [2][Abort?][Yes|No] */
  56.  
  57. /*--- Request types for `ask_user' ---*/
  58. #define REQUEST_NAME 0     /* Document protected, enter name (account) */
  59. #define REQUEST_PASSWORD 1 /* Document protected, enter password       */
  60.  
  61. /*--- Internal images bullets ---*/
  62. #define BULLET_FOLDER "<img src=\"internal-gopher-menu\">"
  63. #define BULLET_TEXT "<img src=\"internal-gopher-text\">"
  64. #define BULLET_IMAGE "<img src=\"internal-gopher-image\">"
  65. #define BULLET_MOVIE "<img src=\"internal-gopher-movie\">"
  66. #define BULLET_SOUND "<img src=\"internal-gopher-sound\">"
  67. #define BULLET_INDEX "<img src=\"internal-gopher-index\">"
  68. #define BULLET_BINARY "<img src=\"internal-gopher-binary\">"
  69. #define BULLET_UNKNOW "<img src=\"internal-gopher-unknown\">"
  70.  
  71.  
  72. /*--- Module functions used by the browser ---*/
  73. typedef struct
  74. {
  75.   void ___CDECL (*restore)(void);
  76.   long ___CDECL (*get_url)(char *url, char *filename);
  77.   long ___CDECL (*get_url_info)(char *url, long *time, long *size, char *mime);
  78.   void ___CDECL (*get_version)(char **author, long *version, long *date);
  79.   long ___CDECL (*post)(char *url, char *content, char *enctype, char *filename);
  80.   long ___CDECL (*mailto)(char *url, char *subject, char *filename);
  81.   long ___CDECL (*get_url_if_modified)(char *url, char *filename, long *time);
  82.  
  83. /* --- new since CAB 2.7 ---*/
  84.   long ___CDECL (*get_url_cookie)(char *url, char *filename, char *cookie);
  85.   long ___CDECL (*post_cookie)(char *url, char *content, char *enctype, char *filename, char *cookie);
  86.   long ___CDECL (*get_url_ifmod_cookie)(char *url, char *filename, long *time, char *cookie);
  87.  
  88.   long reserved[3];
  89. } url_methods_t;
  90.  
  91.  
  92. /*--- Browser functions intended to be used by module ---*/
  93.  
  94. typdef struct
  95. {
  96.    char *ftp_proxy;
  97.    char *http_proxy;
  98.    char *wais_proxy;
  99.    char *gopher_proxy;
  100.    char *news_proxy;
  101.    char *no_proxy;
  102.    char *smtp_server;
  103.    char *nntp_server;
  104. } proxy_url;
  105.  
  106. typedef struct
  107. {
  108.   /*___AES arrays in case of GEM use___*/
  109.   int *aes_control;
  110.   int *aes_global;
  111.   int *aes_intin;
  112.   int *aes_intout;
  113.   long   *aes_addrin;
  114.   long   *aes_addrout;
  115.  
  116.   /*___Init AES in case of GEM use___*/
  117.   void   ___CDECL (*aes_crystal)(void);
  118.  
  119.   /*___Send AES messages to browser___*/
  120.   void   ___CDECL (*aes_messages)(int *msg);
  121.  
  122.   /*___Display error message (see errno.h)___*/
  123.   void   ___CDECL (*msg_error)(long errno);
  124.  
  125.   /*___Display status message___*/
  126.   void   ___CDECL (*msg_status)(long no, long val);
  127.  
  128.   /*___Sleeps for `time' msec, returns pointer to AES msg___*/
  129.   /* 0L -> no message, go on / -1L -> no messages abort */
  130.   long   ___CDECL (*aes_events)(long msec);
  131.  
  132.   /*___Alert box___*/
  133.   long   ___CDECL (*alert_box)(long button, long msg);
  134.  
  135.   /*___Use in case of pexec(0, ...)___*/
  136.   void   ___CDECL (*begin_pexec)();
  137.   void   ___CDECL (*end_pexec)();
  138.  
  139.   /*___Clear cache to get at least `size' bytes free___*/
  140.   /* -1 -> failure / 0 -> OK */
  141.   int ___CDECL (*clear_cache)(long size);
  142.  
  143.   /*___Get a new filename for spcific URL___*/
  144.   /* -1 -> already cached / 0 -> OK */
  145.   int ___CDECL (*new_url)(char *url, char **file);
  146.  
  147.   /*___Ask user for a text entry ___*/
  148.   /* 1 -> OK button / 0 -> CANCEL button / -1 -> error*/
  149.   int ___CDECL (*ask_user)(long msg, char **answer);
  150.  
  151.   /*___Address of the basepage of the module__*/
  152.   long basepage;
  153.  
  154.   /*___*reloadflag is 1 if the user wants to reload the page___*/
  155.   int *reloadflag;
  156.  
  157.   /*___ Version of CAB in ASCII format. V1.30 is 0x30313330  ___*/
  158.   long version;
  159.  
  160.   /*___ Pointer to the proxy information ___*/
  161.   proxy_url *proxy;
  162.  
  163.   /*___ Tell CAB, that it is now online or offline ___*/
  164.   void ___CDECL (*online)(int state);
  165.  
  166.   /*___ Store new cookie  ___*/
  167.   void ___CDECL (*cookie)(char *url, char *name, char *value, 
  168.                           char *expires, char *path, char *domain, 
  169.                           int secure);
  170.  
  171.   /*___Reserved for future uses___*/
  172.   long   reserved[2];
  173. } browser_info_t;
  174.  
  175.  
  176. #endif /* !__BROWSER_INET_API__H__ */
  177.